package com.xxx.modules.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xxx.modules.entity.User;
import com.xxx.modules.mapper.BiteMapper;
import com.xxx.modules.entity.Bite;
import com.xxx.modules.mapper.UserMapper;
import com.xxx.modules.service.BiteService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import java.util.List;
import java.util.Arrays;
import com.xxx.modules.utils.TimeUtil;

/**
 * bite
 *
 * @author 北易航
 * @since 1.0.0 2022-12-28
 */
@Service
public class BiteServiceImpl extends ServiceImpl<BiteMapper, Bite> implements BiteService {

    @Autowired
    private BiteMapper biteMapper;
    @Autowired
    private UserMapper userMapper;


    @Override
    public PageInfo<Bite> selectBiteInfo(Bite bite, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        QueryWrapper<Bite> wrapper = new QueryWrapper<>();
        List<Bite> data = biteMapper.selectListInfo(bite);
        return new PageInfo<>(data);
    }

    @Override
    public void saveBiteInfo(Bite bite) {
        biteMapper.insert(bite);
    }

    @Override
    public void updateBiteInfo(Bite bite) {
        biteMapper.updateById(bite);
    }

    @Override
    public void delBiteInfo(Integer id) {
        biteMapper.deleteById(id);
    }

    @Override
    public void delBatchBiteInfo(String idList) {
        List<String> list = Arrays.asList(idList.split(","));
        biteMapper.deleteBatchIds(list);
    }


}